<div class="sub-main-container">
    <div class="search-wrap">
        <form nz-form [nzLayout]="'inline'" [formGroup]="searchForm">
            <nz-form-item>
                <nz-form-label>日期</nz-form-label>
                <nz-form-control>
                    <nz-date-picker formControlName="ctCreatetime"></nz-date-picker>
                </nz-form-control>
            </nz-form-item>
            <nz-form-item>
                <nz-form-control>
                    <button nz-button nzType="primary" (click)="queryInfo(true)"><i nz-icon nzType="search"></i>查询
                    </button>
                </nz-form-control>
            </nz-form-item>
            <nz-form-item>
                <nz-form-control>
                    <button nz-button (click)="resetQueryInfo()">重置
                    </button>
                </nz-form-control>
            </nz-form-item>
        </form>
        <button nz-button nzType="danger" class="add-btn" (click)="openEditModal()">
            <i nz-icon nzType="plus" nzTheme="outline"></i>新增
        </button>
    </div>

    <div class="main-wrap">
        <nz-table #dataTable
                  class="main-table"
                  [nzData]="tableData"
                  [nzTotal]="total"
                  [nzFrontPagination]="false"
                  [(nzPageIndex)]="pageNum"
                  [(nzPageSize)]="pageSize"
                  [nzLoading]="loading"
                  (nzPageIndexChange)="queryInfo()"
                  nzBordered
                  nzSize="middle">
            <thead>
            <tr>
                <th nzWidth="125px">序号</th>
                <th>记录名称</th>
                <th nzWidth="275px">创建时间</th>
                <th nzWidth="200px">操作</th>
            </tr>
            </thead>
            <tbody>
            <tr *ngFor="let data of dataTable.data; let idx = index;">
                <td>{{pageSize * (pageNum - 1) + idx + 1}}</td>
                <td>{{data.ctCreatetime | date: 'yyyy年MM月dd日' }}领导值班记录</td>
                <td>{{data.createtime }}</td>
                <td>
                    <a (click)="openEditModal(data)">详情</a>
                    <nz-divider nzType="vertical"></nz-divider>
                    <a nz-popconfirm nzPopconfirmTitle="确认删除？" nzPopconfirmPlacement="left"
                       (nzOnConfirm)="onDelete(data.id)">
                        删除
                    </a>
                </td>
            </tr>
            </tbody>
        </nz-table>
    </div>

    <nz-modal nzClassName="custom-modal dt-records-modal" nzWidth="760" [(nzVisible)]="modalShow"
              [nzTitle]="modalTitle"
              (nzOnCancel)="onCancel()" (nzOnOk)="onConfirm()">
        <div class="form-container">
            <form nz-form [formGroup]="form">
                <div nz-row [nzGutter]="24">
                    <div nz-col [nzSpan]="12">
                        <nz-form-item>
                            <nz-form-label nzRequired>日期</nz-form-label>
                            <nz-form-control>
                                <nz-date-picker formControlName="ctCreatetime"
                                                nzShowTime
                                                nzFormat="yyyy-MM-dd"
                                                nzPlaceHolder="日期"></nz-date-picker>
                            </nz-form-control>
                        </nz-form-item>
                    </div>
                    <div nz-col [nzSpan]="12">
                        <nz-form-item>
                            <nz-form-label nzRequired>天气</nz-form-label>
                            <nz-form-control>
                                <input nz-input formControlName="weather" placeholder="天气">
                            </nz-form-control>
                        </nz-form-item>
                    </div>
                    <div nz-col [nzSpan]="24">
                        <div class="form-field">
                            <div class="form-field-label">渠道各段行水情况</div>
                            <div nz-row [nzGutter]="24" style="margin-top: 12px">
                                <div nz-col [nzSpan]="12">
                                    <nz-form-item>
                                        <nz-form-label nzRequired>胜金关（m³/s）</nz-form-label>
                                        <nz-form-control>
                                            <input nz-input formControlName="flow1">
                                        </nz-form-control>
                                    </nz-form-item>
                                </div>
                                <div nz-col [nzSpan]="12">
                                    <nz-form-item>
                                        <nz-form-label nzRequired>新寺沟（m³/s）</nz-form-label>
                                        <nz-form-control>
                                            <input nz-input formControlName="flow2">
                                        </nz-form-control>
                                    </nz-form-item>
                                </div>
                                <div nz-col [nzSpan]="24">
                                    <nz-form-item>
                                        <nz-form-label nzRequired>各主要建筑物险工险段过水情况</nz-form-label>
                                        <nz-form-control>
                                            <textarea formControlName="canalWaterInfo" nz-input rows="2"></textarea>
                                        </nz-form-control>
                                    </nz-form-item>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div nz-col [nzSpan]="12">
                        <nz-form-item>
                            <nz-form-label nzRequired>渠道和填方段运行情况</nz-form-label>
                            <nz-form-control>
                                <textarea formControlName="canalOperatingCondition" nz-input rows="2"></textarea>
                            </nz-form-control>
                        </nz-form-item>
                    </div>
                    <div nz-col [nzSpan]="12">
                        <nz-form-item>
                            <nz-form-label nzRequired>各类建筑物及防汛工程运行情况</nz-form-label>
                            <nz-form-control>
                                <textarea formControlName="buildOperating_condition" nz-input rows="2"></textarea>
                            </nz-form-control>
                        </nz-form-item>
                    </div>
                    <div nz-col [nzSpan]="12">
                        <nz-form-item>
                            <nz-form-label nzRequired>防汛情况</nz-form-label>
                            <nz-form-control>
                                <textarea formControlName="floodInfo" nz-input rows="2"></textarea>
                            </nz-form-control>
                        </nz-form-item>
                    </div>
                    <div nz-col [nzSpan]="12">
                        <nz-form-item>
                            <nz-form-label nzRequired>各种记录填写情况</nz-form-label>
                            <nz-form-control>
                                <textarea formControlName="recordInfo" nz-input rows="2"></textarea>
                            </nz-form-control>
                        </nz-form-item>
                    </div>
                    <div nz-col [nzSpan]="12">
                        <nz-form-item>
                            <nz-form-label nzRequired>养护员上岗及维护渠道情况</nz-form-label>
                            <nz-form-control>
                                <textarea formControlName="opreatingInfo" nz-input rows="2"></textarea>
                            </nz-form-control>
                        </nz-form-item>
                    </div>
                    <div nz-col [nzSpan]="12">
                        <nz-form-item>
                            <nz-form-label nzRequired>出现异常和险情汇报处理及其他事项</nz-form-label>
                            <nz-form-control>
                                <textarea formControlName="errorInfo" nz-input rows="2"></textarea>
                            </nz-form-control>
                        </nz-form-item>
                    </div>
                    <div nz-col [nzSpan]="12">
                        <nz-form-item>
                            <nz-form-label nzRequired>值班处（所）长</nz-form-label>
                            <nz-form-control>
                                <input nz-input formControlName="dutyDirector" placeholder="值班处（所）长">
                            </nz-form-control>
                        </nz-form-item>
                    </div>
                    <div nz-col [nzSpan]="12">
                        <nz-form-item>
                            <nz-form-label nzRequired>值班科长（调度）</nz-form-label>
                            <nz-form-control>
                                <input nz-input formControlName="dutyChief" placeholder="值班科长（调度）">
                            </nz-form-control>
                        </nz-form-item>
                    </div>
                </div>
            </form>
        </div>

    </nz-modal>

</div>
